<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" charset="utf-8"> </script>
<script languge="javascript">


//global this variables
var timeID = null;   
var std_kw = "";
var current_kw = "";
//global end.
function counter()
{ 
    current_kw = $("#query").attr("value");
    if (!std_kw)
    {
        std_kw = current_kw;
        if (std_kw.length>0)
        {
            clean();
            search();
        }   
    }
    else
    {
        if (std_kw != current_kw)
        {
            std_kw = current_kw;
            clean();
            if (std_kw.length>0)
            {
                search();
            }
        }
    }
return false;
}
function end()
{   
    clearInterval(timeID)
return false;
}
function run()
{   
    timeID = setInterval('counter()', 1500); 
}
function search()
{
    $.post("/search/",{"keyword":std_kw},function(data){
//  alert(data);
    $("#respond").append(data);
});
return false;
}
function clean()
{   
    $("#search").remove();
}
</script>

<div align=left>
    <p>
        <input type="text" size=40 id="query" name="keyword" onFocus="run();"  onblur="end();"  />
        <button id="q" onclick="search();">搜索</button>
        <button id="c" onclick="clean();">clean</button>
    </p>
    </div>
<script languge="javascript">
    var std_kw = $("#query").attr("value");
    if (std_kw.length >0)   
    {
        search();
    }
    std_kw = "";
    </script>
<p></p>
<div id="respond"></div>
